<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>

<title>Randomness (randoop 4.1.0 API)</title>

<link rel="stylesheet" type="text/css" href="../../javadocstyle.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
    try {
        if (location.href.indexOf('is-external=true') == -1) {
            parent.document.title="Randomness (randoop 4.1.0 API)";
        }
    }
    catch(err) {
    }
//-->
var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../randoop/util/ProgressDisplay.Mode.html" title="enum in randoop.util"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../randoop/util/RandoopLoggingError.html" title="class in randoop.util"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?randoop/util/Randomness.html" target="_top">Frames</a></li>
<li><a href="Randomness.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">randoop.util</div>
<h2 title="Class Randomness" class="title">Class Randomness</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>randoop.util.Randomness</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public final class <span class="typeNameLabel">Randomness</span>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">A simple-to-use wrapper around <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Random.html?is-external=true" title="class or interface in java.util"><code>Random</code></a>.

 <p>It also supports logging, for debugging of apparently nondeterministic behavior.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!--   -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>(package private) static <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Random.html?is-external=true" title="class or interface in java.util">Random</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#random">random</a></span></code>
<div class="block">The random generator that makes random choices.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#SEED">SEED</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Field.html?is-external=true" title="class or interface in java.lang.reflect">Field</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#seedField">seedField</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#totalCallsToRandom">totalCallsToRandom</a></span></code>
<div class="block">Number of calls to the underlying Random instance that this wraps.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#verbosity">verbosity</a></span></code>
<div class="block">0 = no output, 1 = brief output, 2 = verbose output</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!--   -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier</th>
<th class="colLast" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#Randomness--">Randomness</a></span>()</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!--   -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>private static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#binarySearchForIndex-double:A-double-">binarySearchForIndex</a></span>(double[]&nbsp;cumulativeWeights,
                    double&nbsp;point)</code>
<div class="block">Performs a binary search on a cumulative weight distribution and returns the corresponding
 index i such that <code>cumulativeWeights.get(i) &lt; point &lt;= cumulativeWeights.get(i + 1)</code> for
 <code>0 &lt;= i &lt; cumulativeWeights.length</code>.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static long</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#getSeed--">getSeed</a></span>()</code>
<div class="block">Get the seed.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>private static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#incrementCallsToRandom-java.lang.String-">incrementCallsToRandom</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;caller)</code>
<div class="block">Call this before every use of Randomness.random.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>private static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#logSelection-java.lang.Object-java.lang.String-java.lang.Object-">logSelection</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;returnValue,
            <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;methodName,
            <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;argument)</code>
<div class="block">Logs the value that was randomly selected, along with the calling method and its argument.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#nextRandomInt-int-">nextRandomInt</a></span>(int&nbsp;i)</code>
<div class="block">Uniformly random int from [0, i)</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#randomBoolFromDistribution-double-double-">randomBoolFromDistribution</a></span>(double&nbsp;falseProb,
                          double&nbsp;trueProb)</code>
<div class="block">Return true or false with the given relative probabilites, which need not add to 1.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#randomMember-java.util.List-">randomMember</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;T&gt;&nbsp;list)</code>
<div class="block">Returns a randomly-chosen member of the list.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#randomMember-randoop.util.SimpleList-">randomMember</a></span>(<a href="../../randoop/util/SimpleList.html" title="interface in randoop.util">SimpleList</a>&lt;T&gt;&nbsp;list)</code>
<div class="block">Returns a randomly-chosen member of the list.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#randomMemberWeighted-randoop.util.SimpleList-java.util.Map-">randomMemberWeighted</a></span>(<a href="../../randoop/util/SimpleList.html" title="interface in randoop.util">SimpleList</a>&lt;T&gt;&nbsp;list,
                    <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;T,<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</a>&gt;&nbsp;weights)</code>
<div class="block">Randomly selects an element from a weighted distribution of elements.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#randomMemberWeighted-randoop.util.SimpleList-java.util.Map-double-">randomMemberWeighted</a></span>(<a href="../../randoop/util/SimpleList.html" title="interface in randoop.util">SimpleList</a>&lt;T&gt;&nbsp;list,
                    <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;T,<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</a>&gt;&nbsp;weights,
                    double&nbsp;totalWeight)</code>
<div class="block">Randomly selects an element from a weighted distribution of elements.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>static &lt;T&gt;&nbsp;T</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#randomSetMember-java.util.Collection-">randomSetMember</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;T&gt;&nbsp;set)</code>
<div class="block">Return a random member of the set, selected uniformly at random.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#setSeed-long-">setSeed</a></span>(long&nbsp;newSeed)</code>&nbsp;</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>private static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#toString-java.lang.Object-">toString</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;o)</code>
<div class="block">Produces a printed representation of the object, depending on the verbosity level.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>static boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../randoop/util/Randomness.html#weightedCoinFlip-double-">weightedCoinFlip</a></span>(double&nbsp;trueProb)</code>
<div class="block">Return true with probability <code>trueProb</code>, otherwise false.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!--   -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!--   -->
</a>
<h3>Field Detail</h3>
<a name="verbosity">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>verbosity</h4>
<pre>public static&nbsp;int verbosity</pre>
<div class="block">0 = no output, 1 = brief output, 2 = verbose output</div>
</li>
</ul>
<a name="SEED">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SEED</h4>
<pre>public static final&nbsp;long SEED</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../constant-values.html#randoop.util.Randomness.SEED">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="random">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>random</h4>
<pre>static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Random.html?is-external=true" title="class or interface in java.util">Random</a> random</pre>
<div class="block">The random generator that makes random choices. (Developer note: do not declare new Random
 objects; use this one instead).</div>
</li>
</ul>
<a name="seedField">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>seedField</h4>
<pre>private static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Field.html?is-external=true" title="class or interface in java.lang.reflect">Field</a> seedField</pre>
</li>
</ul>
<a name="totalCallsToRandom">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>totalCallsToRandom</h4>
<pre>private static&nbsp;int totalCallsToRandom</pre>
<div class="block">Number of calls to the underlying Random instance that this wraps.</div>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!--   -->
</a>
<h3>Constructor Detail</h3>
<a name="Randomness--">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Randomness</h4>
<pre>private&nbsp;Randomness()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!--   -->
</a>
<h3>Method Detail</h3>
<a name="setSeed-long-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSeed</h4>
<pre>public static&nbsp;void&nbsp;setSeed(long&nbsp;newSeed)</pre>
</li>
</ul>
<a name="getSeed--">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSeed</h4>
<pre>public static&nbsp;long&nbsp;getSeed()</pre>
<div class="block">Get the seed.

 <p>To exactly reproduce the state, the result needs to be XOR'd with 0x5DEECE66DL if passed to
 setSeed, because setSeed internally XORs with that value.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the internal random seed</dd>
</dl>
</li>
</ul>
<a name="incrementCallsToRandom-java.lang.String-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>incrementCallsToRandom</h4>
<pre>private static&nbsp;void&nbsp;incrementCallsToRandom(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;caller)</pre>
<div class="block">Call this before every use of Randomness.random.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>caller</code> - the name of the method that called Randomness.random</dd>
</dl>
</li>
</ul>
<a name="nextRandomInt-int-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>nextRandomInt</h4>
<pre>public static&nbsp;int&nbsp;nextRandomInt(int&nbsp;i)</pre>
<div class="block">Uniformly random int from [0, i)</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>i</code> - upper bound on range for generated values</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a value selected from range [0, i)</dd>
</dl>
</li>
</ul>
<a name="randomMember-java.util.List-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>randomMember</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;T&nbsp;randomMember(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</a>&lt;T&gt;&nbsp;list)</pre>
<div class="block">Returns a randomly-chosen member of the list.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the type of list elements</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>list</code> - the list from which to choose a random member</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a randomly-chosen member of the list</dd>
</dl>
</li>
</ul>
<a name="randomMember-randoop.util.SimpleList-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>randomMember</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;T&nbsp;randomMember(<a href="../../randoop/util/SimpleList.html" title="interface in randoop.util">SimpleList</a>&lt;T&gt;&nbsp;list)</pre>
<div class="block">Returns a randomly-chosen member of the list.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the type of list elements</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>list</code> - the list from which to choose a random member</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a randomly-chosen member of the list</dd>
</dl>
</li>
</ul>
<a name="randomMemberWeighted-randoop.util.SimpleList-java.util.Map-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>randomMemberWeighted</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;T&nbsp;randomMemberWeighted(<a href="../../randoop/util/SimpleList.html" title="interface in randoop.util">SimpleList</a>&lt;T&gt;&nbsp;list,
                                         <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;T,<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</a>&gt;&nbsp;weights)</pre>
<div class="block">Randomly selects an element from a weighted distribution of elements. These weights are with
 respect to each other. They are not normalized (they might add up to any value).</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the type of the elements in the list</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>list</code> - the list of elements to select from</dd>
<dd><code>weights</code> - the map of elements to their weights. Each element's weight must be
     non-negative. An element with a weight of zero will never be selected.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a randomly selected element from <code>list</code></dd>
</dl>
</li>
</ul>
<a name="randomMemberWeighted-randoop.util.SimpleList-java.util.Map-double-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>randomMemberWeighted</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;T&nbsp;randomMemberWeighted(<a href="../../randoop/util/SimpleList.html" title="interface in randoop.util">SimpleList</a>&lt;T&gt;&nbsp;list,
                                         <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a>&lt;T,<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Double.html?is-external=true" title="class or interface in java.lang">Double</a>&gt;&nbsp;weights,
                                         double&nbsp;totalWeight)</pre>
<div class="block">Randomly selects an element from a weighted distribution of elements. These weights are with
 respect to each other. They are not normalized (they might add up to any value).</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the type of the elements in the list</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>list</code> - the list of elements to select from</dd>
<dd><code>weights</code> - the map of elements to their weights. Each element's weight must be
     non-negative. An element with a weight of zero will never be selected.</dd>
<dd><code>totalWeight</code> - the total weight of the elements of the list</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a randomly selected element from <code>list</code></dd>
</dl>
</li>
</ul>
<a name="binarySearchForIndex-double:A-double-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>binarySearchForIndex</h4>
<pre>private static&nbsp;int&nbsp;binarySearchForIndex(double[]&nbsp;cumulativeWeights,
                                        double&nbsp;point)</pre>
<div class="block">Performs a binary search on a cumulative weight distribution and returns the corresponding
 index i such that <code>cumulativeWeights.get(i) &lt; point &lt;= cumulativeWeights.get(i + 1)</code> for
 <code>0 &lt;= i &lt; cumulativeWeights.length</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cumulativeWeights</code> - the cumulative weight distribution to search through. The ith element
     is the cumulative weight of all elements before the ith (that is, exclusive rather than
     inclusive). The last (i+1)th element is the weight of all elements.</dd>
<dd><code>point</code> - the value used to find the index within the cumulative weight distribution</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the index corresponding to point's location in the cumulative weight distribution</dd>
</dl>
</li>
</ul>
<a name="randomSetMember-java.util.Collection-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>randomSetMember</h4>
<pre>public static&nbsp;&lt;T&gt;&nbsp;T&nbsp;randomSetMember(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</a>&lt;T&gt;&nbsp;set)</pre>
<div class="block">Return a random member of the set, selected uniformly at random.</div>
<dl>
<dt><span class="paramLabel">Type Parameters:</span></dt>
<dd><code>T</code> - the type of elements of the set param set the collection from which to choose an
     element</dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>set</code> - the collection from which to select an element</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a randomly-selected member of the set</dd>
</dl>
</li>
</ul>
<a name="weightedCoinFlip-double-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>weightedCoinFlip</h4>
<pre>public static&nbsp;boolean&nbsp;weightedCoinFlip(double&nbsp;trueProb)</pre>
<div class="block">Return true with probability <code>trueProb</code>, otherwise false.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>trueProb</code> - the likelihood that true is returned; must be within [0..1]</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true with likelihood <code>trueProb</code>; otherwise false</dd>
</dl>
</li>
</ul>
<a name="randomBoolFromDistribution-double-double-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>randomBoolFromDistribution</h4>
<pre>public static&nbsp;boolean&nbsp;randomBoolFromDistribution(double&nbsp;falseProb,
                                                 double&nbsp;trueProb)</pre>
<div class="block">Return true or false with the given relative probabilites, which need not add to 1.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>falseProb</code> - the likelihood that true is returned; an arbitrary non-negative number</dd>
<dd><code>trueProb</code> - the likelihood that true is returned; an arbitrary non-negative number</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>true or false, with the given probabilities</dd>
</dl>
</li>
</ul>
<a name="logSelection-java.lang.Object-java.lang.String-java.lang.Object-">
<!--   -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>logSelection</h4>
<pre>private static&nbsp;void&nbsp;logSelection(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;returnValue,
                                 <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;methodName,
                                 <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;argument)</pre>
<div class="block">Logs the value that was randomly selected, along with the calling method and its argument.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>returnValue</code> - the value randomly selected</dd>
<dd><code>methodName</code> - the name of the method called</dd>
<dd><code>argument</code> - the method argument</dd>
</dl>
</li>
</ul>
<a name="toString-java.lang.Object-">
<!--   -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>private static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;toString(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;o)</pre>
<div class="block">Produces a printed representation of the object, depending on the verbosity level.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>o</code> - the object to produce a printed representation of</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a printed representation of the argument</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../randoop/util/Randomness.html#verbosity"><code>verbosity</code></a></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../index-all.html">Index</a></li>
<li><a href="../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../randoop/util/ProgressDisplay.Mode.html" title="enum in randoop.util"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../randoop/util/RandoopLoggingError.html" title="class in randoop.util"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?randoop/util/Randomness.html" target="_top">Frames</a></li>
<li><a href="Randomness.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
